package cn.gzmli.dtt.common.entity;

import cn.gzmli.dtt.sbzyc.validation.Add;
import cn.gzmli.dtt.sbzyc.validation.Delete;
import cn.gzmli.dtt.sbzyc.validation.Update;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Descript
 * @Author xsx
 * @Date 2017/12/25
 */
@Entity(name="Department")
@Table(name = "department")
@Data
public class Department implements Serializable {

    private static final long serialVersionUID = 717941118034906154L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = {Update.class, Delete.class})
    private Integer id;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "pId", referencedColumnName = "id")
    private Department parent;

    private String no;

    @NotNull(groups = {Update.class, Add.class})
    private String name;

    private String description;
    private Integer orderNo;
    private Integer type;
    private Integer level;
    private Integer regionId;

}
